<?php
namespace ctrl\demo;
use L;

use Sdk\Winit\CallApiUtil;

class winit
{
    ////http://ec.com/?c=demo_winit&a=warehouseList
    public static function warehouseList()
    {
        $method = 'queryWarehouse';
        $data = [];
        $result = CallApiUtil::callWinitApi($method, $data);
        echo '<pre />';
        print_r($result);
    }

    //同步库存  http://ec.com/?c=demo_winit&a=pull
    public static function pull()
    {
        \serv\task\warehouse\winit::pull();
    }

    //同步库存队列  http://ec.com/?c=demo_winit&a=pullQueue
    public static function pullQueue()
    {
        $string = '{"warehouse_id":"1018192","warehouse_code":"USTX"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\winit::pull($data);
        var_dump($result);
    }

    //写入库存队列 http://ec.com/?c=demo_winit&a=stock
    public static function stock()
    {
        $string = '{"warehouse_id":"1030042", "merchandiseSerno":"M010000000003436808","qtyAvailable":"0","customerCode":null,"producLenght":93,"qtyFrozen":0,"inventory":"0","isActive":"Y","warehouseName":"AUME Warehouse","warehouseCode":"AUME","productName":"椅子配件","qtyDestruction":0,"prohibitFrozenQty":"0","pipelineInventory":"0","qtySellHisOut":"40","productWidth":58,"qtySw":"0","warehouseID":1030042,"qtyLostConfirming":0,"productLength":93,"qtyWaitOut":"0","preSaleWaitOutQty":0,"addValueFrozenQty":0,"productHeight":32,"qtyShareStorage":"0","specification":null,"productWeight":19,"inStockQty":"0","prohibitUsableQty":0,"isReturnInventory":"N","productCode":"A000021-LBK-XXA(RETURN)","sourceProductCode":null,"reservedInventory":"0"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\winit::check($data);
        var_dump($result);
    }
}